import request from '@/utils/request'

export function GetMap(parameter) {
  return request({
    url: '/api/dictionary/get',
    method: 'get',
    params: parameter,
    needToken: true,
  })
}

// 根据id值获取下级字典
export function GetDict(parameter) {
  return request({
    url: '/api/dictionary/getdictbyid',
    method: 'get',
    params: parameter,
    needToken: true,
  })
}

// 根据Pid值获取下级字典
export function GetDictByPid(parameter) {
  return request({
    url: '/api/dictionary/getdict',
    method: 'get',
    params: parameter,
    needToken: true,
  })
}

export function Add(parameter, data) {
  return request({
    url: '/api/dictionary/add',
    method: 'post',
    params: parameter,
    data: data,
    needToken: true,
  })
}

export function Delete(parameter) {
  return request({
    url: '/api/dictionary/delete',
    method: 'delete',
    params: parameter,
    needToken: true,
  })
}
export function Update(parameter, data) {
  return request({
    url: '/api/dictionary/update',
    method: 'post',
    params: parameter,
    data: data,
    needToken: true,
  })
}

export function GetDictByCode(parameter) {
  return request({
    url: '/api/dictionary/getDictByCode',
    method: 'get',
    params: parameter,
    needToken: true,
  })
}

export function GetNames(parameter) {
  return request({
    url: '/api/dictionary/getnames',
    method: 'post',
    params: parameter,
    needToken: true,
  })
}
